<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>竞赛题库管理管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
		function checkValidate()
		{
			var courseName=document.getElementById("courseName").value;
			var courseAttribute=document.getElementById("courseAttribute").value;
			var duallist=document.getElementById("duallist").value;
			//判断是否为空
			if(courseName==""||courseName==null)
			{
				window.alertx("请输入题库名称！");
				return false;
			}

			if(duallist==""||duallist==null)
			{
				window.alertx("请选择题目！");
				return false;
			}
		}
	</script>

	<script type="text/javascript" src="${path}/js/common/jquery.min.js"></script>
	<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" type="text/css" media="all">
	<%--<link rel="stylesheet" href="${path}/css/common/bootstrap.min.css" rel="stylesheet" type="text/css" media="all"/>--%>
	<link rel="stylesheet" href="${path}/css/common/bootstrap-duallistbox.css" rel="stylesheet" type="text/css"/>
	<script type="text/javascript" src="${path}/js/common/jquery.bootstrap-duallistbox.js"></script>

	<style>
		.control-label{font-weight: normal;}
		#courseName{ height: 30px;}
	</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/race/raceRepertory/">竞赛题库列表</a></li>
		<li class="active"><a><c:if test="${copy=='copy'}">复制题库</c:if><c:if test="${copy=='no'}">编辑题库</c:if></a></li>
	</ul><br/>


	<%--<c:if test="${copy=='copy'}">复制题库</c:if> <c:if test="${copy=='no'}">编辑题库</c:if>--%>

	<form:form id="inputForm" modelAttribute="raceRepertory" action="${ctx}/race/raceRepertory/save" method="post" class="form-horizontal">

		<input type="hidden" name="copy" id="type" value="${copy}">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>
		<input type="hidden" value="${raceRepertory.id}" path="id">


		<div class="control-group">
			<label class="control-label">题库名称：</label>
			<div class="controls">
				<input type="text" value="${raceRepertory.repertoryName}" name="repertoryName" id="courseName"  >
			</div>
		</div>





		<div class="control-group">
			<label class="control-label">CTF题目：</label>
			<div class="controls">
				<div class="container"></div>
					<%--<%@ include file="maskProgramFormTest.jsp"%>--%>
				<div class="col-lg-10 col-md-9 col-sm-9 col-xs-12">

					<select  multiple="multiple" size="10" id="duallist" name="duallist" class="resetDuallist">

					<c:forEach items="${resourceCtfSubjects}"  var="resourceCtfSubject">

						<option>${resourceCtfSubject.ctfSubjectName}</option>

					</c:forEach>


						

					<c:forEach items="${raceSubject}" var="raceSubject">

						<option  selected>${raceSubject.ctfSubjectName}</option>

					</c:forEach>

				</select>
				</div>
				<span class="help-inline" ><font color="red">*</font> </span>
			</div>
		</div>









		<div class="control-group">
			<label class="control-label">题库详情：</label>
			<div class="controls">
				<form:textarea value="${raceRepertory.repertoryDetail}" path="repertoryDetail" htmlEscape="false" rows="4" maxlength="128" class="input-xxlarge" />
			</div>
		</div>






		<div class="form-actions">
			<shiro:hasPermission name="race:raceRepertory:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存" onclick=" return checkValidate()"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
	<script>
		var demo1 = $('select[class="resetDuallist"]').bootstrapDualListbox();





		$("#demoform").submit(function() {
			alert($('[class="resetDuallist"]').val());
			return false;
		});
	</script>
</body>
</html>